<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
		<link rel="stylesheet" href="styles/screen.css" type="text/css"/>
		<script src="scripts/jquery.js" type="text/javascript"></script>
		<script src="scripts/init.js" type="text/javascript"></script>
		<title>title</title>
	</head>
	<body>
		<h1 id="header">title</h1>
		<ul id="navigation"></ul>
		
		<div class="message">Build request with XMLHttpRequest object. The Same origin policies apply.</div>
		<form>
			<label for="method">method</label><br/>
			<input name="method" value="GET" type="text" size="50"/><br/>
			<label for="URL">URL (same origin)</label><br/>
			<input name="URL" value="http://www.gnucitizen.org" type="text" size="50"/><br/>
			<label for="headers">headers</label><br/>
			<textarea name="headers" cols="50" rows="10"></textarea><br/>
			<label for="body">body</label><br/>
			<textarea name="body" cols="50" rows="10"></textarea><br/>
			<label for="result">result</label><br/>
			<textarea name="result" cols="50" rows="10"></textarea><br/>
			<input name="request" value="Request" type="button"/>
			<input name="reset" value="Reset" type="button"/>
		</form>
		
		<script src="../lib/AttackAPI/AttackAPI.js" type="text/javascript"></script>
		<script src="../lib/AttackAPI/RequestBuilder.js" type="text/javascript"></script>
		<script type="text/javascript">
			$('input[@name="request"]').click(function () {
				var form = $(this).parent().get(0);
				var request = AttackAPI.RequestBuilder.build();
				
				request.onreadystatechange = function () {
					if (request.readyState == 4)
						form.result.value = request.responseText; 
				};
				request.open(form.method.value, form.URL.value, true);
				request.send(form.body.value);
			});
			
			$('input[@name="reset"]').click(function () {
				$(this).parent().get(0).result.value = '';
			});
		</script>
		
		<p id="footer"><a href="http://www.gnucitizen.org">GNUCITIZEN</a> &copy; 2006 all rights reserved</p>
	</body>
</html>